package com.gjzhao.fmmall.controller;

import com.gjzhao.fmmall.service.UserAddrService;
import com.gjzhao.fmmall.vo.ResponseResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: 用户地址 Controller
 * @Author: gjzhao
 * @Date Created in 2022-01-05 10:17 下午
 */
@RestController
@RequestMapping("/userAddr")
@CrossOrigin
@Api(value = "用户地址信息接口", tags = "用户地址管理")
public class UserAddrController extends BaseController {

    @Autowired
    private UserAddrService userAddrService;


    /**
     * 用户收货地址列表展示
     *  - 1.点击 去结算 进入到结算页时，展示用户所有收货地址信息
     *
     * @param token
     * @param userId
     * @return
     */
    @GetMapping("/list")
    @ApiOperation(value = "获取收获地址列表")
    @ApiImplicitParam(value = "用户id", name = "userId", dataType = "int", required = true)
    public ResponseResultVO listUserAddr(@RequestHeader("token") String token, String userId) {
        ResponseResultVO responseResultVO = userAddrService.listUserAddr(userId);
        return responseResultVO;
    }


}
